using Microsoft.EntityFrameworkCore;
using NETCORE.EF.DBFirst.Models;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();


//  Scaffold-DbContext 'server=localhost;userid=root;password=root;database=large;' Pomelo.EntityFrameworkCore.MySql -OutputDir Models -Context DBContext
//  Scaffold-DbContext 'server=localhost;userid=root;password=root;database=large;' Pomelo.EntityFrameworkCore.MySql -OutputDir Models -Context DBContext -Force
builder.Services.AddDbContext<DBContext>(options => options.UseMySql(builder.Configuration.GetConnectionString("MysqlConnection"), new MySqlServerVersion(new Version(8, 0, 11))));

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
